﻿using aier.business.logic;
using aier.dataaccess.model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;

namespace aier.wx.api.selfhost.Controllers
{
    //[Authorize]
    [RoutePrefix("api/City")]
    public  class CityController:ApiController
    {
        public CityBll cityBll { get; set; }
        /// <summary>
        /// 根据省查所属市 
        /// 原程序 LocationQueryServiceImpl/queryCityByProvince
        /// </summary>
        /// <param name="provinceid">省份ID</param>
        /// <returns></returns>
        [HttpGet]
        [ActionName("QueryCityByProvinceId")]
        public IHttpActionResult QueryCityByProvinceId(Guid provinceid)
        {
            List<CityView> cityViews = cityBll.QueryCityByProvinceId(provinceid);
            return Ok<List<CityView>>(cityViews);
        }
        /// <summary>
        /// 根据市编号查询市信息  LocationQueryServiceImpl/queryCityById
        /// </summary>
        /// <param name="cityid"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("QueryCityById")]
        public IHttpActionResult QueryCityById(Guid cityid)
        {
            CityView cityView = cityBll.QueryCityById(cityid);
            return Ok<CityView>(cityView);
        }
    }
}
